package com.test03;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Random;

public class RandomNum {
    public static void main(String[] args) {
        HashSet<Integer> rand = new HashSet<>();
        Random r = new Random();
        while(rand.size()<10){
            int num = r.nextInt(20)+1;
            rand.add(num);
        }
        ArrayList<Integer> rand2 = new ArrayList<>();
        for (Integer i : rand) {
            rand2.add(i);
        }
        for (int i = 0; i < rand2.size(); i++) {
            System.out.print(rand2.get(i)+" ");
        }
    }
}
